﻿<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Channel9Kinect="clr-namespace:Channel9Kinect" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:Core="clr-namespace:Channel9Kinect.Core" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:KinectExtensions_Interactivity="clr-namespace:KinectExtensions.Interactivity;assembly=KinectExtensions" x:Class="Channel9Kinect.Player" mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1024" Title="Player">
	<Page.Resources>
		<Core:StripHtmlConverter x:Key="html" />
		<Channel9Kinect:PlayerViewModel x:Key="playerViewModel" />
		<Storyboard x:Key="CloseSummary">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" />
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="grid">
				<DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}" />
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
	</Page.Resources>

	<Grid DataContext="{StaticResource playerViewModel}">
		<Rectangle Width="1024" Height="768" Stretch="Fill">
			<Rectangle.Fill>
				<LinearGradientBrush StartPoint="0.417188,-0.0851852" EndPoint="0.417188,1.02593">
					<GradientStop Color="#FF018396" Offset="0.224638" />
					<GradientStop Color="#FF005966" Offset="0.768116" />
				</LinearGradientBrush>
			</Rectangle.Fill>
		</Rectangle>
		<MediaElement x:Name="player" LoadedBehavior="Manual" Source="{Binding MediaSource}" Height="768" Width="1024" />
		<Grid x:Name="grid" Background="#D80E0E0E">

			<Grid.RowDefinitions>
				<RowDefinition Height="*" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>

			<Grid Margin="150,120" VerticalAlignment="Center" HorizontalAlignment="Center">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>
				<Grid Width="160" Height="150" Grid.Column="0" Grid.Row="0" Margin="10,5,0,0">
					<Image Width="160" Height="120" Source="{Binding DefaultImageSource, Source={StaticResource playerViewModel}}" />
					<Image Width="160" Height="120" Source="{Binding Item.ThumbnailNode.ThumbnailUri}" />
					<Grid VerticalAlignment="Bottom">
						<Rectangle Width="160" Height="30" Stretch="Fill">
							<Rectangle.Fill>
								<LinearGradientBrush StartPoint="3.70813e-007,0.500001" EndPoint="1,0.500001">
									<GradientStop Color="#7D004852" Offset="0.224638" />
									<GradientStop Color="#7D004D58" Offset="0.789855" />
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<TextBlock TextAlignment="Left" FontFamily="Segoe UI" FontSize="16" Width="Auto" Height="Auto" Text="{Binding Item.Title.Text}" Foreground="#FFFFFFFF" />
					</Grid>

				</Grid>

				<TextBlock TextWrapping="Wrap" Grid.Column="2" Foreground="White" FontSize="20" Margin="30,0">
					<Run Text="{Binding Item.PublishDate, StringFormat=f}" />
					<LineBreak />
					<LineBreak />
					<Run Text="{Binding Item.Summary, Converter={StaticResource html}}" />
				</TextBlock>
			</Grid>

			<Grid Background="Black" Height="100" VerticalAlignment="Bottom">
				<Grid HorizontalAlignment="Center" Background="#00000000">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseLeftButtonDown">
							<i:InvokeCommandAction Command="{Binding Play}" />
						</i:EventTrigger>
						<KinectExtensions_Interactivity:KinectDelayActionTrigger>
							<i:InvokeCommandAction Command="{Binding Play}" />
						</KinectExtensions_Interactivity:KinectDelayActionTrigger>
						<KinectExtensions_Interactivity:VoiceTrigger BarHintText="play" VoiceString="play">
							<i:InvokeCommandAction Command="{Binding Play}" />
						</KinectExtensions_Interactivity:VoiceTrigger>
					</i:Interaction.Triggers>
					<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
						<Grid Height="68.974" VerticalAlignment="Top">
							<Ellipse Stretch="Fill" StrokeThickness="5" StrokeLineJoin="Round" Stroke="#FFFFFFFF" />
							<Path Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 1256.5,984.621L 1276.7,998.853L 1263.14,1008.41L 1257.68,1012.26L 1256.5,1013.09" Margin="27.87,20.254,20.904,20.255" />
						</Grid>
						<TextBlock TextWrapping="Wrap" Text="Watch" VerticalAlignment="Center" Foreground="White" FontSize="26.667" Margin="10,0,9.037,0" d:LayoutOverrides="Width" />

					</StackPanel>
				</Grid>
			</Grid>
		</Grid>
		<Grid HorizontalAlignment="Left" Height="92.974" Margin="100.513,32.513,0,0" VerticalAlignment="Top" Width="92.973" Background="#00000000">

			<i:Interaction.Triggers>
				<i:EventTrigger EventName="MouseLeftButtonDown">
					<i:InvokeCommandAction Command="{Binding Back}" />
				</i:EventTrigger>
				<KinectExtensions_Interactivity:KinectDelayActionTrigger IsMagneticZone="True">
					<i:InvokeCommandAction Command="{Binding Back}" />
				</KinectExtensions_Interactivity:KinectDelayActionTrigger>
			</i:Interaction.Triggers>

			<Canvas Margin="0,0,-0.001,0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center" Height="70.858" Width="70.858">
				<Canvas.RenderTransform>
					<TransformGroup>
						<ScaleTransform ScaleX="0.7" ScaleY="0.7" />
						<SkewTransform />
						<RotateTransform />
						<TranslateTransform />
					</TransformGroup>
				</Canvas.RenderTransform>
				<Ellipse Width="68.9736" Height="68.9736" Canvas.Left="-6.10352e-005" Canvas.Top="0" Stretch="Fill" StrokeThickness="5" StrokeLineJoin="Round" Stroke="#FFFFFFFF" />
				<Path Width="36.9079" Height="27.292" Canvas.Left="14.9853" Canvas.Top="19.9265" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 27.4573,30.148L 38.2931,19.9265L 29.4809,19.9265L 14.9853,33.604L 29.4178,47.2184L 38.2271,47.2184L 27.4573,37.0571L 51.8932,37.0571L 51.8932,30.148L 27.4573,30.148 Z " />
			</Canvas>

		</Grid>
	</Grid>
</Page>